<template>
	<view>
		<view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
			<view class="u-m-r-10">
				<u-avatar :src="base+info.avatar" size="140"></u-avatar>
			</view>
			<view class="u-flex-1">
				<view class="u-font-18 u-p-b-20">{{info.nickName}}</view>
				<view class="u-font-14 u-tips-color">账号:{{info.userId}}</view>
			</view>
			<view class="u-m-l-10 u-p-10">
				<u-icon name="scan" color="#969799" size="28"></u-icon>
			</view>
			<view class="u-m-l-10 u-p-10">
				<u-icon name="arrow-right" color="#969799" size="28"></u-icon>
			</view>
		</view>
		
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="rmb-circle" title="个人信息" @click="toxin(1)"></u-cell-item>
			</u-cell-group>
		</view>
		<view class="u-m-t-20">
			<u-cell-group>
				<u-cell-item icon="star" title="订单列表"  @click="toxin(2)"></u-cell-item>
				<u-cell-item icon="photo" title="修改密码"  @click="toxin(3)"></u-cell-item>
				<u-cell-item icon="coupon" title="意见反馈"  @click="toxin(4)"></u-cell-item>
				<u-cell-item icon="heart" title="意见反馈历史"  @click="toxin(5)"></u-cell-item>
			</u-cell-group>
		</view>
		
		<view class="u-m-t-20">
			<button type="primary" @click="outLogin">退出账号</button>
		</view>
	</view>
</template>

<script>
	import api from 'commer/apiURL.js'
	export default {
		data() {
			return {
				base:api.baseurl,
				info:[]
			}
		},
		onShow() {
			this.getinfo()
		},
		methods: {
			//退出账号
			outLogin(){
				uni.removeStorageSync('token')
				uni.removeStorageSync('info')
				uni.redirectTo({
					url:'../login/login'
				})
			},
			getinfo(){
				this.$get(this.base+'/prod-api/api/common/user/getInfo').then((res)=>{		
					this.info = res.user
				})
			},
			toxin(index){
				if(index == 1){
					uni.navigateTo({
						url:'user1/user1'
					})
				}else if(index == 2){
					uni.navigateTo({
						url:'user1/ding2'
					})
				}else if(index == 3){
					uni.navigateTo({
						url:'user1/xiu'
					})
				}else if(index == 4){
					uni.navigateTo({
						url:'user1/fan'
					})
				}else if(index == 5){
					uni.navigateTo({
						url:'user1/olfyishi'
					})
				}
			}
		}
	}
</script>

<style lang="scss">
page{
	background-color: #ededed;
}

.camera{
	width: 54px;
	height: 44px;
	
	&:active{
		background-color: #ededed;
	}
}
.user-box{
	background-color: #fff;
}
</style>
